<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<title>TravelDream</title>
	<link rel="stylesheet" type="text/css" href="../style/prodottobase.css" />
</h:head>
<h:body>
<div id="main">
		<div id="upper">
			<div id="logo"><a href="/TravelDreamWeb/home.jsf"><img id="logo-img" src="../img/logo.png"/></a></div>
			<div id="login-up">Benvenuto, #{utenteBean.name} <br />
				<h:form><p:commandButton action="#{logoutBean.logout()}" value="Logout" />
				<h:link outcome="PaginaDatiPersonali" value="Modifica dati personali" /></h:form>
			</div>
		</div>
		<div id="center">
		<div id="center1">
			<p:outputLabel value="Hotel inseriti: " /><br/>
			<h:form id="form">
			<p:dataTable style="width:700px" id="hotelPanel" value="#{hotelBean.listaHotel}" var="hotel" emptyMessage="Nessun hotel inserito."
				paginator="true" rows="10"  
        		paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
        		rowsPerPageTemplate="5,10,15">  
				<p:column headerText="Nome" >
					<h:outputText value="#{hotel.nome}" />
				</p:column>
				<p:column headerText="Numero stelle">
					<h:outputText value="#{hotel.numeroStelle}" />
				</p:column>
				<p:column headerText="Prezzo(€)">
					<h:outputText value="#{hotel.prezzo}" />
				</p:column>
				<p:column  width="90">
				<p:column style="width:4%">  
            		<p:commandButton id="selectButton" update=":form:display" oncomplete="PF('hotelDialog').show()" value="Modifica" title="View"
                		action="#{hotelBean.setHotel(hotelBean.getHotelSelected(hotel.idHotel))}" > 
            		</p:commandButton>  
        		</p:column>
				</p:column>
				<p:column width="90">
					<p:commandButton value="Elimina" action="#{hotelBean.elimina(hotel.idHotel)}"/>
				</p:column>
			</p:dataTable> 
				
			<p:dialog header="Modifica hotel" widgetVar="hotelDialog" resizable="false"  id="hotelDlg"  
                showEffect="fade" hideEffect="drop" modal="true">  
        		<h:panelGrid id="display" columns="3" cellpadding="4" style="margin:0 auto;">
					<h:outputText value=" " />  
        			<h:outputText value="Vecchio Valore" style="font-weight:bold"/>  
        			<h:outputText value="Nuovo Valore" style="font-weight:bold"/>  
  
            		<h:outputText value="Nome:" style="font-weight:bold"/>  
            		<h:outputText value="#{hotelBean.hotel.nome}" /> 
            		<p:inputText value="#{hotelBean.getHotel().nome}"  />      
  
    		        <h:outputText value="Numero stelle:" style="font-weight:bold"/>  
         		   	<h:outputText value="#{hotelBean.hotel.numeroStelle}" />
         		   	<p:selectOneMenu id="numeroStelle" value="#{hotelBean.getHotel().numeroStelle}">  
            		  	<f:selectItem itemLabel="1 Stella" itemValue="1" />  
            	  		<f:selectItem itemLabel="2 Stelle" itemValue="2" />  
            	  		<f:selectItem itemLabel="3 Stelle" itemValue="3" />  
            	  		<f:selectItem itemLabel="4 Stelle" itemValue="4" /> 
            	  		<f:selectItem itemLabel="5 Stelle" itemValue="5" /> 
        			</p:selectOneMenu>  
           
           			<h:outputText value="Prezzo(€):" style="font-weight:bold"/>  
            		<h:outputText value="#{hotelBean.hotel.prezzo}" /> 
            		<p:inputText value="#{hotelBean.getHotel().prezzo}" /> 
                     
            		<h:outputText value=" " />
            		<p:commandButton value="Modifica"
						action="#{hotelBean.modifica()}" />
        		</h:panelGrid>  
   			 </p:dialog>  
		</h:form>
		</div></div>
		<div id="footer">
			<h:link outcome="PaginaPrincipale" value="Torna alla pagina principale" />
		</div>
	</div>
</h:body>
</html>